package com.reportes;

import android.content.Context;
import android.database.DataSetObserver;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.BaseAdapter;

public class ImageAdapter extends BaseAdapter  {
	private Context mContext;
	private Imagen_Nombre[] arrayPic;
	
    public ImageAdapter(Context c,Imagen_Nombre[]  array) {
        mContext = c;
        arrayPic = array;
    }

    public int getCount() {
        return arrayPic.length;
    }

    public String getItem(int position) {
        return arrayPic[position].getNombre();
    }

    public long getItemId(int position) {
        return 0;
    }

    // create a new ImageView for each item referenced by the Adapter
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
            imageView = new ImageView(mContext);
            imageView.setLayoutParams(new GridView.LayoutParams(185, 185));
            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
            imageView.setPadding(8, 8, 8, 8);
        } else {
            imageView = (ImageView) convertView;
        }

        imageView.setImageResource(arrayPic[position].getPic());
        return imageView;
    }

    // references to our images
    /*private Integer[] mThumbIds = {
            R.drawable.concert,
            R.drawable.concert,
            R.drawable.concert,
            R.drawable.concert,
            R.drawable.concert,
            R.drawable.concert,
            R.drawable.concert,
            R.drawable.concert,
            R.drawable.concert,
            R.drawable.concert,
            R.drawable.concert
            
    };*/

}
